﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Threading;

namespace Scalextric
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            f1Lights1.SetStatus(StatusType.Default);
            //Thread.Sleep(2000);
            f1Lights1.TimeDelay = 5.5;
            f1Lights1.SetStatus(StatusType.StartingRace);
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            f1Lights1.SetStatus(StatusType.Stop);
        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
            f1Lights1.SetStatus(StatusType.Warning);
        }

        private void button4_Click(object sender, RoutedEventArgs e)
        {
            f1Lights1.SetStatus(StatusType.Go);
        }

        private void button5_Click(object sender, RoutedEventArgs e)
        {
            f1Lights1.SetStatus(StatusType.Default);
        }

        private void button6_Click(object sender, RoutedEventArgs e)
        {
            f1RaceFlag1.SetFlag(Flags.Default);
        }

        private void button7_Click(object sender, RoutedEventArgs e)
        {
            f1RaceFlag1.SetFlag(Flags.TrackClear);
        }

        private void button8_Click(object sender, RoutedEventArgs e)
        {
            f1RaceFlag1.SetFlag(Flags.EndofRace);
        }

        private void f1Lights1_StatusChanged(object sender, StatusArgs e)
        {
            int a = 1;
        }

        private void f1Lights1_RaceStarted(object sender, EventArgs e)
        {
            int b = 0;
        }

        private void button9_Click(object sender, RoutedEventArgs e)
        {
            Track t1 = new Track();
            t1.Length = 27;
            raceControl1.Track = t1;
            raceControl1.SetFastestLap(new TimeSpan(0, 0, 0, 10, 456), "David Piesse");
            raceControl1.SessionTime = new TimeSpan(0, 0, 17);
            raceControl1.StartSession();
            //raceControl1.f1RaceFlag1.SetFlag(Flags.EndofRace);
        }

        private void button10_Click(object sender, RoutedEventArgs e)
        {
            raceControl1.PauseSession();
        }

        private void button11_Click(object sender, RoutedEventArgs e)
        {
            raceControl1.ResumeSession();
        }

        private void button12_Click(object sender, RoutedEventArgs e)
        {
            raceControl1.StopSession();
        }

        private void button13_Click(object sender, RoutedEventArgs e)
        {
            TestWindow win = new TestWindow();
            win.ShowDialog();
        }
    }
}
